#!/usr/bin/python
# -*- coding: utf-8 -*-

class Interval:

    def __init__ (self, low_limit, high_limit, extreme_limit):
        
        self._low_limit = low_limit
        self._high_limit = high_limit
        self._extreme_limit = extreme_limit

    def evaluate (self, v):

        if (self._low_limit == None) or (self._high_limit == None) or (self._extreme_limit == None):
            return 1.0

        if v >= self._low_limit and v <= self._high_limit:
            return 1.0
        elif v > self._high_limit and v < self._extreme_limit:
            return (v - self._high_limit) / (self._extreme_limit - self._high_limit)
        else:
            return 0.0

    def __str__ (self):

        return str(self._low_limit) + ', ' + str(self._high_limit) + ', ' + str(self._extreme_limit)
